package com.ycky.detectionProcess;

import java.util.List;

/**
 * @description:
 * @author: cjj
 * @time: 2025/3/18 15:32
 */
public class KeywordMatchingStrategy implements ContextDetectionStrategy {

    // todo 提供表结构和初始数据，第三方集成者可自行搭建库数据
    private final List<String> sensitiveKeywords;

    public KeywordMatchingStrategy(List<String> sensitiveKeywords) {
        this.sensitiveKeywords = sensitiveKeywords;
    }

    @Override
    public boolean detect(String text) {
        for (String keyword : sensitiveKeywords) {
            if (text.contains(keyword)) {
                return true;
            }
        }
        return false;
    }
}